/*
 * Description: 防止按钮重复点击，注：需要使用button按钮
 * Author: ty
 * Created on 2025-8-12 20:40
 * example: <button v-db-click class="btn btn-default w80 h40 borderRadius-6 mR12" @click="getData()">搜索</button>
 */

const dbClick = {
    bind(el) {
        el.addEventListener('click', e => {
            if (!el.disabled) {
                el.disabled = true
                el.style.cursor = 'not-allowed'
                setTimeout(() => {
                    el.style.cursor = 'pointer'
                    el.disabled = false
                }, 1000)
            }
        })
    },
}

export default dbClick;